<template>
  <div class="gallary" @click="gallaryHideClick">
    <div class="warp">
      <swiper :options="swiperOption">
        <!-- 幻灯内容 -->
        <swiper-slide v-for="(item, index) of imgs" :key="index">
          <img class="swiper-img" :src="item" />
        </swiper-slide>
        <!--<swiper-slide>-->
        <!--<img class="swiper-img" src="" />-->
        <!--</swiper-slide>-->
        <!-- ... -->
        <!-- 以下控件元素均为可选（使用具名slot来确定并应用一些操作控件元素） -->
        <div class="swiper-pagination"  slot="pagination"></div>
        <!--<div class="swiper-button-prev" slot="button-prev"></div>-->
        <!--<div class="swiper-button-next" slot="button-next"></div>-->
        <!--<div class="swiper-scrollbar"   slot="scrollbar"></div>-->
      </swiper>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CommonGallary',
  props: {
    imgs: {
      type: Array,
      default: function () {
        return []
      }
    }
  },
  data: function () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observeParents: true,
        observer: true
      }
    }
  },
  methods: {
    gallaryHideClick: function () {
      this.$emit('gallaryChange')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .gallary
    display: flex
    flex-direction: column
    justify-content: center
    position: fixed
    top: 0
    left: 0
    right: 0
    bottom: 0
    background: #000
    z-index: 99
    .warp >>> .swiper-pagination-bullet-active
      background: #fff !important
    .warp >>> .swiper-container
      overflow: inherit
    .warp
      color: #fff
      font-size: .18rem
      background: #fff
      .swiper-img
        width:100%
      .swiper-pagination-fraction
        bottom: -1rem
</style>
